package WaiBao;

import java.util.Arrays;

public class LiNan {
    public static void main(String[] args) {
        String[] name= {"白居易(班长)", "欧阳修(副班长)", "小李(学习委员)", "李俊良(团支书)", "李有志", "马福报", "李浩男", "马平", "戴强", "戴号", "戴正", "戴多多",
                "李浩浩", "张德伟", "张村发", "张俊杰", "张优秀", "李成功", "李成千", "王算子", "王一凡", "王毫升", "李不负", "杨莹莹", "杨紫", "李浩", "李静", "李爽",
                "提子", "李楠(体育委员)"};//考生本人:李楠(体育委员)
        int[] age = {19, 21, 18, 20,22, 21, 21, 20, 18, 22,19, 21, 19, 19, 21,20, 18, 18, 20, 18, 19,20, 20, 20, 20, 21, 19,20,21, 21};//考生年龄：21岁

        double[] yanghui1 = {81, 66, 84, 91, 61, 71, 88, 88, 77, 91, 83, 77, 85, 77, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 84, 76, 84, 95};
        double[] yanghui2 = {64, 74, 84, 76, 75, 83, 84, 89, 94, 84, 91, 81, 84, 75, 65, 65, 86, 79, 66, 68, 82, 71, 90, 86, 75, 87, 78, 85, 90, 96};
        double[] yanghui3 = {74, 66, 91, 84, 74, 69, 78, 89, 80, 68, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 85, 95, 79, 84, 77, 78, 69, 96};


        double panzi1;//代表每个学生的总分
        double panzi2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            panzi1 =yanghui1[i] + yanghui2[i] +yanghui3[i];
//            panzi2 = (panzi1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + panzi1);
//            System.out.println(name[i] + "的平均分为:" +panzi2);
//        }


        double sougou1 = 0, sougou2 = 0;
        double[] star = new double[30];
//        for (int i = 0; i < 30; i++) {
//            sougou1 = yanghui1[i] + yanghui2[i] +yanghui3[i];
//            sougou2= (sougou1 * 1.0) / 3;
//            star[i] = sougou2;
//        }
//
//        for (int i = 0; i < star.length - 1; i++) {
//            for (int j = 0; j <star.length - i - 1; j++) {
//                if (star[j] < star[j + 1]) {
//                    double tep =star[j];
//                    star[j] =star[j + 1];
//                    star[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(star[i]);
//        }



        double dijia1 = 0,dijia2 = 0, dijia3 = 0;//计算每门课的平均分
        double maoyuan1 = 0,maoyuan2 = 0, maoyuan3 = 0;//计算每门课标准差
        double yida1 = 0,yida2 = 0,yida3 = 0;//计算每门课中位数
        double sum2 = 0;
//        for (int i = 0; i <yanghui1.length; i++) {
//            sum2+=yanghui1[i];
//        }
//        dijia1 = (sum2*1.0)/30;
//        System.out.println("生物化学的班级平均分为:"+dijia1);
//        double Sum = 0;
//        for (int i = 0; i <yanghui2.length; i++) {
//            Sum+=yanghui2[i];
//        }
//        dijia2 = (Sum*1.0)/30;
//        System.out.println("微生物学的班级平均分为:"+dijia2);
//        double sum = 0;
//        for (int i = 0; i <yanghui3.length; i++) {
//            sum+=yanghui3[i];
//        }
//        dijia3 = (sum*1.0)/30;
//        System.out.println("人体组织解剖学的班级平均分为:"+dijia3);
//
//
////
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i <yanghui1.length; i++) {
//            c1+= (yanghui1[i] -dijia1)*(yanghui1[i] - dijia1);
//        }
//        maoyuan1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+maoyuan1);
//
//        for (int i = 0; i < yanghui2.length; i++) {
//            c2+= (yanghui2[i] -dijia2)*(yanghui2[i] - dijia2);
//        }
//        maoyuan2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+maoyuan2);
//
//        for (int i = 0; i <yanghui3.length; i++) {
//            c3+= (yanghui3[i] -dijia3)*(yanghui3[i] - dijia3);
//        }
//        maoyuan3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+maoyuan3);
////////
////////
        Arrays.sort(yanghui1);
        Arrays.sort(yanghui2);
        Arrays.sort(yanghui3);
        yida1 =( yanghui1[14]+yanghui1[15])*1.0/2;
        yida2 =(yanghui2[14]+yanghui2[15])*1.0/2;
        yida3 =(yanghui3[14]+yanghui3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ yida1);
        System.out.println("微生物学的中位数为:"+ yida2);
        System.out.println("人体组织解剖学的中位数为:"+ yida3);


    }
}
